﻿using aier.dataaccess.model;
using Dapper;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace aier.dataaccess.dapper
{
    public class ScreenTemplateDal
    {
        public DapperHelper dapperHelper { get; set; }

    

        public IEnumerable<ScreenTemplateView> GetScreenTemplates() {
            return dapperHelper.ExecueWithoutTransaction<IEnumerable<ScreenTemplateView>>(a =>
            {
                string sql = @"select new_t_sc_page_elementId as templateId,new_name as templateName from new_t_sc_page_element /**where**/ order by CreatedOn desc";
                SqlBuilder sqlBuilder = new SqlBuilder();
                var sqlTemplate = sqlBuilder.AddTemplate(sql);
                sqlBuilder.Where(" statecode = 0");

                return a.Query<ScreenTemplateView>(sqlTemplate.RawSql, sqlTemplate.Parameters);
            });

        }

       
    }
}
